package com.umgsai.thread.thread39;

/**
 * 方法join(long)的使用
 * @author Admin
 *
 */
public class MyThread extends Thread {
	@Override
	public void run() {
		try {
			System.out.println("MyThread开始，time = " + System.currentTimeMillis());
			Thread.sleep(5000);
			System.out.println("MyThread结束，time = " + System.currentTimeMillis());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public static void main(String[] args) {
		try {
			MyThread thread = new MyThread();
			thread.start();
			thread.join(2000);
			System.out.println("main线程结束 time = " + System.currentTimeMillis());
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
